﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace Lesson2_2
{
    class Program
    {
       static private bool IsPrimeMumber(int number)
        {

            if (number < 2)
                return false;
            for (int i = 2; i <= number/2; i++)
            {
                if (number%i == 0)
                    return false;
            }
            return true;
        }

        static void Main()
        {
            Parallel.For(0, int.MaxValue, (i) =>
            {
                if (IsPrimeMumber(i))
                {
                    Console.Write(Thread.CurrentThread.ManagedThreadId);
                    Console.WriteLine("Число {0}, простое", i);
                }
            });
        }
    }
}
